home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_gdb.idb / usr / freeware / info / gdbint.info-1.z / gdbint.info-1
Encoding:
GNU Info File  |  1998-10-28  |  47.9 KB  |  1,108 lines

  1. This is Info file gdbint.info, produced by Makeinfo version 1.68 from
  2. the input file ../../../devo/gdb/doc/gdbint.texinfo.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Gdb-Internals: (gdbint).    The GNU debugger's internals.
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This file documents the internals of the GNU debugger GDB.
  9.  
  10.    Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998 Free Software
  11. Foundation, Inc.  Contributed by Cygnus Support.  Written by John
  12. Gilmore.
  13.  
  14.    Permission is granted to make and distribute verbatim copies of this
  15. manual provided the copyright notice and this permission notice are
  16. preserved on all copies.
  17.  
  18.    Permission is granted to copy or distribute modified versions of this
  19. manual under the terms of the GPL (for which purpose this text may be
  20. regarded as a program in the language TeX).
  21.  
  22. 
  23. File: gdbint.info,  Node: Top,  Next: README,  Up: (dir)
  24.  
  25. Scope of this Document
  26. **********************
  27.  
  28.    This document documents the internals of the GNU debugger, GDB.  It
  29. is intended to document aspects of GDB which apply across many different
  30. parts of GDB (for example, *note Coding Style::.), or which are global
  31. aspects of design (for example, what are the major modules and which
  32. files document them in detail?).  Information which pertains to specific
  33. data structures, functions, variables, etc., should be put in comments
  34. in the source code, not here.  It is more likely to get noticed and kept
  35. up to date there.  Some of the information in this document should
  36. probably be moved into comments.
  37.  
  38. * Menu:
  39.  
  40. * README::            The README File
  41. * Getting Started::        Getting started working on GDB
  42. * Debugging GDB::        Debugging GDB with itself
  43. * New Architectures::        Defining a New Host or Target Architecture
  44. * Config::            Adding a New Configuration
  45. * Host::            Adding a New Host
  46. * Native::            Adding a New Native Configuration
  47. * Target::            Adding a New Target
  48. * Languages::            Defining New Source Languages
  49. * Releases::            Configuring GDB for Release
  50. * Partial Symbol Tables::    How GDB reads symbols quickly at startup
  51. * Types::            How GDB keeps track of types
  52. * BFD support for GDB::        How BFD and GDB interface
  53. * Symbol Reading::        Defining New Symbol Readers
  54. * Cleanups::            Cleanups
  55. * Wrapping::            Wrapping Output Lines
  56. * Frames::            Keeping track of function calls
  57. * Remote Stubs::        Code that runs in targets and talks to GDB
  58. * Longjmp Support::        Stepping through longjmp's in the target
  59. * Coding Style::        Strunk and White for GDB maintainers
  60. * Clean Design::        Frank Lloyd Wright for GDB maintainers
  61. * Submitting Patches::        How to get your changes into GDB releases
  62. * Host Conditionals::        What features exist in the host
  63. * Target Conditionals::        What features exist in the target
  64. * Native Conditionals::        Conditionals for when host and target are same
  65. * Obsolete Conditionals::    Conditionals that don't exist any more
  66. * XCOFF::            The Object file format used on IBM's RS/6000
  67.  
  68. 
  69. File: gdbint.info,  Node: README,  Next: Getting Started,  Prev: Top,  Up: Top
  70.  
  71. The `README' File
  72. *****************
  73.  
  74.    Check the `README' file, it often has useful information that does
  75. not appear anywhere else in the directory.
  76.  
  77. 
  78. File: gdbint.info,  Node: Getting Started,  Next: Debugging GDB,  Prev: README,  Up: Top
  79.  
  80. Getting Started Working on GDB
  81. ******************************
  82.  
  83.    GDB is a large and complicated program, and if you first starting to
  84. work on it, it can be hard to know where to start.  Fortunately, if you
  85. know how to go about it, there are ways to figure out what is going on:
  86.  
  87.    * This manual, the GDB Internals manual, has information which
  88.      applies generally to many parts of GDB.
  89.  
  90.    * Information about particular functions or data structures are
  91.      located in comments with those functions or data structures.  If
  92.      you run across a function or a global variable which does not have
  93.      a comment correctly explaining what is does, this can be thought
  94.      of as a bug in GDB; feel free to submit a bug report, with a
  95.      suggested comment if you can figure out what the comment should
  96.      say (*note Submitting Patches::.).  If you find a comment which is
  97.      actually wrong, be especially sure to report that.
  98.  
  99.      Comments explaining the function of macros defined in host,
  100.      target, or native dependent files can be in several places.
  101.      Sometimes they are repeated every place the macro is defined.
  102.      Sometimes they are where the macro is used.  Sometimes there is a
  103.      header file which supplies a default definition of the macro, and
  104.      the comment is there.  This manual also has a list of macros
  105.      (*note Host Conditionals::., *note Target Conditionals::., *note
  106.      Native Conditionals::., and *note Obsolete Conditionals::.) with
  107.      some documentation.
  108.  
  109.    * Start with the header files.  Once you some idea of how GDB's
  110.      internal symbol tables are stored (see `symtab.h', `gdbtypes.h'),
  111.      you will find it much easier to understand the code which uses and
  112.      creates those symbol tables.
  113.  
  114.    * You may wish to process the information you are getting somehow, to
  115.      enhance your understanding of it.  Summarize it, translate it to
  116.      another language, add some (perhaps trivial or non-useful) feature
  117.      to GDB, use the code to predict what a test case would do and
  118.      write the test case and verify your prediction, etc.  If you are
  119.      reading code and your eyes are starting to glaze over, this is a
  120.      sign you need to use a more active approach.
  121.  
  122.    * Once you have a part of GDB to start with, you can find more
  123.      specifically the part you are looking for by stepping through each
  124.      function with the `next' command.  Do not use `step' or you will
  125.      quickly get distracted; when the function you are stepping through
  126.      calls another function try only to get a big-picture understanding
  127.      (perhaps using the comment at the beginning of the function being
  128.      called) of what it does.  This way you can identify which of the
  129.      functions being called by the function you are stepping through is
  130.      the one which you are interested in.  You may need to examine the
  131.      data structures generated at each stage, with reference to the
  132.      comments in the header files explaining what the data structures
  133.      are supposed to look like.
  134.  
  135.      Of course, this same technique can be used if you are just reading
  136.      the code, rather than actually stepping through it.  The same
  137.      general principle applies--when the code you are looking at calls
  138.      something else, just try to understand generally what the code
  139.      being called does, rather than worrying about all its details.
  140.  
  141.    * A good place to start when tracking down some particular area is
  142.      with a command which invokes that feature.  Suppose you want to
  143.      know how single-stepping works.  As a GDB user, you know that the
  144.      `step' command invokes single-stepping.  The command is invoked
  145.      via command tables (see `command.h'); by convention the function
  146.      which actually performs the command is formed by taking the name
  147.      of the command and adding `_command', or in the case of an `info'
  148.      subcommand, `_info'.  For example, the `step' command invokes the
  149.      `step_command' function and the `info display' command invokes
  150.      `display_info'.  When this convention is not followed, you might
  151.      have to use `grep' or `M-x tags-search' in emacs, or run GDB on
  152.      itself and set a breakpoint in `execute_command'.
  153.  
  154.    * If all of the above fail, it may be appropriate to ask for
  155.      information on `bug-gdb'.  But *never* post a generic question
  156.      like "I was wondering if anyone could give me some tips about
  157.      understanding GDB"--if we had some magic secret we would put it in
  158.      this manual.  Suggestions for improving the manual are always
  159.      welcome, of course.
  160.  
  161.    Good luck!
  162.  
  163. 
  164. File: gdbint.info,  Node: Debugging GDB,  Next: New Architectures,  Prev: Getting Started,  Up: Top
  165.  
  166. Debugging GDB with itself
  167. *************************
  168.  
  169.    If GDB is limping on your machine, this is the preferred way to get
  170. it fully functional.  Be warned that in some ancient Unix systems, like
  171. Ultrix 4.2, a program can't be running in one process while it is being
  172. debugged in another.  Rather than typing the command `./gdb ./gdb',
  173. which works on Suns and such, you can copy `gdb' to `gdb2' and then
  174. type `./gdb ./gdb2'.
  175.  
  176.    When you run GDB in the GDB source directory, it will read a
  177. `.gdbinit' file that sets up some simple things to make debugging gdb
  178. easier.  The `info' command, when executed without a subcommand in a
  179. GDB being debugged by gdb, will pop you back up to the top level gdb.
  180. See `.gdbinit' for details.
  181.  
  182.    If you use emacs, you will probably want to do a `make TAGS' after
  183. you configure your distribution; this will put the machine dependent
  184. routines for your local machine where they will be accessed first by
  185. `M-.'
  186.  
  187.    Also, make sure that you've either compiled GDB with your local cc,
  188. or have run `fixincludes' if you are compiling with gcc.
  189.  
  190. 
  191. File: gdbint.info,  Node: New Architectures,  Next: Config,  Prev: Debugging GDB,  Up: Top
  192.  
  193. Defining a New Host or Target Architecture
  194. ******************************************
  195.  
  196.    When building support for a new host and/or target, much of the work
  197. you need to do is handled by specifying configuration files; *note
  198. Adding a New Configuration: Config..  Further work can be divided into
  199. "host-dependent" (*note Adding a New Host: Host.) and
  200. "target-dependent" (*note Adding a New Target: Target.).  The following
  201. discussion is meant to explain the difference between hosts and targets.
  202.  
  203. What is considered "host-dependent" versus "target-dependent"?
  204. ==============================================================
  205.  
  206.    "Host" refers to attributes of the system where GDB runs.  "Target"
  207. refers to the system where the program being debugged executes.   In
  208. most cases they are the same machine, in which case a third type of
  209. "Native" attributes come into play.
  210.  
  211.    Defines and include files needed to build on the host are host
  212. support.  Examples are tty support, system defined types, host byte
  213. order, host float format.
  214.  
  215.    Defines and information needed to handle the target format are target
  216. dependent.  Examples are the stack frame format, instruction set,
  217. breakpoint instruction, registers, and how to set up and tear down the
  218. stack to call a function.
  219.  
  220.    Information that is only needed when the host and target are the
  221. same, is native dependent.  One example is Unix child process support;
  222. if the host and target are not the same, doing a fork to start the
  223. target process is a bad idea.  The various macros needed for finding the
  224. registers in the `upage', running `ptrace', and such are all in the
  225. native-dependent files.
  226.  
  227.    Another example of native-dependent code is support for features
  228. that are really part of the target environment, but which require
  229. `#include' files that are only available on the host system.  Core file
  230. handling and `setjmp' handling are two common cases.
  231.  
  232.    When you want to make GDB work "native" on a particular machine, you
  233. have to include all three kinds of information.
  234.  
  235.    The dependent information in GDB is organized into files by naming
  236. conventions.
  237.  
  238.    Host-Dependent Files
  239. `config/*/*.mh'
  240.      Sets Makefile parameters
  241.  
  242. `config/*/xm-*.h'
  243.      Global #include's and #define's and definitions
  244.  
  245. `*-xdep.c'
  246.      Global variables and functions
  247.  
  248.    Native-Dependent Files
  249. `config/*/*.mh'
  250.      Sets Makefile parameters (for *both* host and native)
  251.  
  252. `config/*/nm-*.h'
  253.      #include's and #define's and definitions.  This file is only
  254.      included by the small number of modules that need it, so beware of
  255.      doing feature-test #define's from its macros.
  256.  
  257. `*-nat.c'
  258.      global variables and functions
  259.  
  260.    Target-Dependent Files
  261. `config/*/*.mt'
  262.      Sets Makefile parameters
  263.  
  264. `config/*/tm-*.h'
  265.      Global #include's and #define's and definitions
  266.  
  267. `*-tdep.c'
  268.      Global variables and functions
  269.  
  270.    At this writing, most supported hosts have had their host and native
  271. dependencies sorted out properly.  There are a few stragglers, which
  272. can be recognized by the absence of NATDEPFILES lines in their
  273. `config/*/*.mh'.
  274.  
  275. 
  276. File: gdbint.info,  Node: Config,  Next: Host,  Prev: New Architectures,  Up: Top
  277.  
  278. Adding a New Configuration
  279. **************************
  280.  
  281.    Most of the work in making GDB compile on a new machine is in
  282. specifying the configuration of the machine.  This is done in a
  283. dizzying variety of header files and configuration scripts, which we
  284. hope to make more sensible soon.  Let's say your new host is called an
  285. XXX (e.g.  `sun4'), and its full three-part configuration name is
  286. `XARCH-XVEND-XOS' (e.g.  `sparc-sun-sunos4').  In particular:
  287.  
  288.    In the top level directory, edit `config.sub' and add XARCH, XVEND,
  289. and XOS to the lists of supported architectures, vendors, and operating
  290. systems near the bottom of the file.  Also, add XXX as an alias that
  291. maps to `XARCH-XVEND-XOS'.  You can test your changes by running
  292.  
  293.      ./config.sub XXX
  294.  
  295. and
  296.      ./config.sub `XARCH-XVEND-XOS'
  297.  
  298. which should both respond with `XARCH-XVEND-XOS' and no error messages.
  299.  
  300.    Now, go to the `bfd' directory and create a new file
  301. `bfd/hosts/h-XXX.h'.  Examine the other `h-*.h' files as templates, and
  302. create one that brings in the right include files for your system, and
  303. defines any host-specific macros needed by BFD, the Binutils, GNU LD,
  304. or the Opcodes directories.  (They all share the bfd `hosts' directory
  305. and the `configure.host' file.)
  306.  
  307.    Then edit `bfd/configure.host'.  Add a line to recognize your
  308. `XARCH-XVEND-XOS' configuration, and set `my_host' to XXX when you
  309. recognize it.  This will cause your file `h-XXX.h' to be linked to
  310. `sysdep.h' at configuration time.  When creating the line that
  311. recognizes your configuration, only match the fields that you really
  312. need to match; e.g. don't match the architecture or manufacturer if the
  313. OS is sufficient to distinguish the configuration that your `h-XXX.h'
  314. file supports.  Don't match the manufacturer name unless you really
  315. need to.  This should make future ports easier.
  316.  
  317.    Also, if this host requires any changes to the Makefile, create a
  318. file `bfd/config/XXX.mh', which includes the required lines.
  319.  
  320.    It's possible that the `libiberty' and `readline' directories won't
  321. need any changes for your configuration, but if they do, you can change
  322. the `configure.in' file there to recognize your system and map to an
  323. `mh-XXX' file.  Then add `mh-XXX' to the `config/' subdirectory, to set
  324. any makefile variables you need.  The only current options in there are
  325. things like `-DSYSV'.  (This `mh-XXX' naming convention differs from
  326. elsewhere in GDB, by historical accident.  It should be cleaned up so
  327. that all such files are called `XXX.mh'.)
  328.  
  329.    Aha!  Now to configure GDB itself!  Edit `gdb/configure.in' to
  330. recognize your system and set `gdb_host' to XXX, and (unless your
  331. desired target is already available) also set `gdb_target' to something
  332. appropriate (for instance, XXX).  To handle new hosts, modify the
  333. segment after the comment `# per-host'; to handle new targets, modify
  334. after `# per-target'.
  335.  
  336.    Finally, you'll need to specify and define GDB's host-, native-, and
  337. target-dependent `.h' and `.c' files used for your configuration; the
  338. next two chapters discuss those.
  339.  
  340. 
  341. File: gdbint.info,  Node: Host,  Next: Native,  Prev: Config,  Up: Top
  342.  
  343. Adding a New Host
  344. *****************
  345.  
  346.    Once you have specified a new configuration for your host (*note
  347. Adding a New Configuration: Config.), there are three remaining pieces
  348. to making GDB work on a new machine.  First, you have to make it host
  349. on the new machine (compile there, handle that machine's terminals
  350. properly, etc).  If you will be cross-debugging to some other kind of
  351. system that's already supported, you are done.
  352.  
  353.    If you want to use GDB to debug programs that run on the new machine,
  354. you have to get it to understand the machine's object files, symbol
  355. files, and interfaces to processes; *note Adding a New Target: Target.
  356. and *note Adding a New Native Configuration: Native.
  357.  
  358.    Several files control GDB's configuration for host systems:
  359.  
  360. `gdb/config/ARCH/XXX.mh'
  361.      Specifies Makefile fragments needed when hosting on machine XXX.
  362.      In particular, this lists the required machine-dependent object
  363.      files, by defining `XDEPFILES=...'.  Also specifies the header
  364.      file which describes host XXX, by defining `XM_FILE= xm-XXX.h'.
  365.      You can also define `CC', `REGEX' and `REGEX1', `SYSV_DEFINE',
  366.      `XM_CFLAGS', `XM_ADD_FILES', `XM_CLIBS', `XM_CDEPS', etc.; see
  367.      `Makefile.in'.
  368.  
  369. `gdb/config/ARCH/xm-XXX.h'
  370.      (`xm.h' is a link to this file, created by configure).  Contains C
  371.      macro definitions describing the host system environment, such as
  372.      byte order, host C compiler and library, ptrace support, and core
  373.      file structure.  Crib from existing `xm-*.h' files to create a new
  374.      one.
  375.  
  376. `gdb/XXX-xdep.c'
  377.      Contains any miscellaneous C code required for this machine as a
  378.      host.  On many machines it doesn't exist at all.  If it does
  379.      exist, put `XXX-xdep.o' into the `XDEPFILES' line in
  380.      `gdb/config/mh-XXX'.
  381.  
  382. Generic Host Support Files
  383. --------------------------
  384.  
  385.    There are some "generic" versions of routines that can be used by
  386. various systems.  These can be customized in various ways by macros
  387. defined in your `xm-XXX.h' file.  If these routines work for the XXX
  388. host, you can just include the generic file's name (with `.o', not
  389. `.c') in `XDEPFILES'.
  390.  
  391.    Otherwise, if your machine needs custom support routines, you will
  392. need to write routines that perform the same functions as the generic
  393. file.  Put them into `XXX-xdep.c', and put `XXX-xdep.o' into
  394. `XDEPFILES'.
  395.  
  396. `ser-bsd.c'
  397.      This contains serial line support for Berkeley-derived Unix
  398.      systems.
  399.  
  400. `ser-go32.c'
  401.      This contains serial line support for 32-bit programs running
  402.      under DOS using the GO32 execution environment.
  403.  
  404. `ser-termios.c'
  405.      This contains serial line support for System V-derived Unix
  406.      systems.
  407.  
  408.    Now, you are now ready to try configuring GDB to compile using your
  409. system as its host.  From the top level (above `bfd', `gdb', etc), do:
  410.  
  411.      ./configure XXX --target=vxworks960
  412.  
  413.    This will configure your system to cross-compile for VxWorks on the
  414. Intel 960, which is probably not what you really want, but it's a test
  415. case that works at this stage.  (You haven't set up to be able to debug
  416. programs that run *on* XXX yet.)
  417.  
  418.    If this succeeds, you can try building it all with:
  419.  
  420.      make
  421.  
  422.    Repeat until the program configures, compiles, links, and runs.
  423. When run, it won't be able to do much (unless you have a VxWorks/960
  424. board on your network) but you will know that the host support is
  425. pretty well done.
  426.  
  427.    Good luck!  Comments and suggestions about this section are
  428. particularly welcome; send them to `bug-gdb@prep.ai.mit.edu'.
  429.  
  430. 
  431. File: gdbint.info,  Node: Native,  Next: Target,  Prev: Host,  Up: Top
  432.  
  433. Adding a New Native Configuration
  434. *********************************
  435.  
  436.    If you are making GDB run native on the XXX machine, you have plenty
  437. more work to do.  Several files control GDB's configuration for native
  438. support:
  439.  
  440. `gdb/config/XARCH/XXX.mh'
  441.      Specifies Makefile fragments needed when hosting *or native* on
  442.      machine XXX.  In particular, this lists the required
  443.      native-dependent object files, by defining `NATDEPFILES=...'.  Also
  444.      specifies the header file which describes native support on XXX,
  445.      by defining `NAT_FILE= nm-XXX.h'.  You can also define
  446.      `NAT_CFLAGS', `NAT_ADD_FILES', `NAT_CLIBS', `NAT_CDEPS', etc.; see
  447.      `Makefile.in'.
  448.  
  449. `gdb/config/ARCH/nm-XXX.h'
  450.      (`nm.h' is a link to this file, created by configure).  Contains C
  451.      macro definitions describing the native system environment, such
  452.      as child process control and core file support.  Crib from
  453.      existing `nm-*.h' files to create a new one.
  454.  
  455. `gdb/XXX-nat.c'
  456.      Contains any miscellaneous C code required for this native support
  457.      of this machine.  On some machines it doesn't exist at all.
  458.  
  459. Generic Native Support Files
  460. ----------------------------
  461.  
  462.    There are some "generic" versions of routines that can be used by
  463. various systems.  These can be customized in various ways by macros
  464. defined in your `nm-XXX.h' file.  If these routines work for the XXX
  465. host, you can just include the generic file's name (with `.o', not
  466. `.c') in `NATDEPFILES'.
  467.  
  468.    Otherwise, if your machine needs custom support routines, you will
  469. need to write routines that perform the same functions as the generic
  470. file.  Put them into `XXX-nat.c', and put `XXX-nat.o' into
  471. `NATDEPFILES'.
  472.  
  473. `inftarg.c'
  474.      This contains the *target_ops vector* that supports Unix child
  475.      processes on systems which use ptrace and wait to control the
  476.      child.
  477.  
  478. `procfs.c'
  479.      This contains the *target_ops vector* that supports Unix child
  480.      processes on systems which use /proc to control the child.
  481.  
  482. `fork-child.c'
  483.      This does the low-level grunge that uses Unix system calls to do a
  484.      "fork and exec" to start up a child process.
  485.  
  486. `infptrace.c'
  487.      This is the low level interface to inferior processes for systems
  488.      using the Unix `ptrace' call in a vanilla way.
  489.  
  490. `core-aout.c::fetch_core_registers()'
  491.      Support for reading registers out of a core file.  This routine
  492.      calls `register_addr()', see below.  Now that BFD is used to read
  493.      core files, virtually all machines should use `core-aout.c', and
  494.      should just provide `fetch_core_registers' in `XXX-nat.c' (or
  495.      `REGISTER_U_ADDR' in `nm-XXX.h').
  496.  
  497. `core-aout.c::register_addr()'
  498.      If your `nm-XXX.h' file defines the macro `REGISTER_U_ADDR(addr,
  499.      blockend, regno)', it should be defined to set `addr' to the
  500.      offset within the `user' struct of GDB register number `regno'.
  501.      `blockend' is the offset within the "upage" of `u.u_ar0'.  If
  502.      `REGISTER_U_ADDR' is defined, `core-aout.c' will define the
  503.      `register_addr()' function and use the macro in it.  If you do not
  504.      define `REGISTER_U_ADDR', but you are using the standard
  505.      `fetch_core_registers()', you will need to define your own version
  506.      of `register_addr()', put it into your `XXX-nat.c' file, and be
  507.      sure `XXX-nat.o' is in the `NATDEPFILES' list.  If you have your
  508.      own `fetch_core_registers()', you may not need a separate
  509.      `register_addr()'.  Many custom `fetch_core_registers()'
  510.      implementations simply locate the registers themselves.
  511.  
  512.    When making GDB run native on a new operating system, to make it
  513. possible to debug core files, you will need to either write specific
  514. code for parsing your OS's core files, or customize `bfd/trad-core.c'.
  515. First, use whatever `#include' files your machine uses to define the
  516. struct of registers that is accessible (possibly in the u-area) in a
  517. core file (rather than `machine/reg.h'), and an include file that
  518. defines whatever header exists on a core file (e.g. the u-area or a
  519. `struct core').  Then modify `trad_unix_core_file_p()' to use these
  520. values to set up the section information for the data segment, stack
  521. segment, any other segments in the core file (perhaps shared library
  522. contents or control information), "registers" segment, and if there are
  523. two discontiguous sets of registers (e.g.  integer and float), the
  524. "reg2" segment.  This section information basically delimits areas in
  525. the core file in a standard way, which the section-reading routines in
  526. BFD know how to seek around in.
  527.  
  528.    Then back in GDB, you need a matching routine called
  529. `fetch_core_registers()'.  If you can use the generic one, it's in
  530. `core-aout.c'; if not, it's in your `XXX-nat.c' file.  It will be
  531. passed a char pointer to the entire "registers" segment, its length,
  532. and a zero; or a char pointer to the entire "regs2" segment, its
  533. length, and a 2.  The routine should suck out the supplied register
  534. values and install them into GDB's "registers" array.  (*Note Defining
  535. a New Host or Target Architecture: New Architectures, for more info
  536. about this.)
  537.  
  538.    If your system uses `/proc' to control processes, and uses ELF
  539. format core files, then you may be able to use the same routines for
  540. reading the registers out of processes and out of core files.
  541.  
  542. 
  543. File: gdbint.info,  Node: Target,  Next: Languages,  Prev: Native,  Up: Top
  544.  
  545. Adding a New Target
  546. *******************
  547.  
  548.    For a new target called TTT, first specify the configuration as
  549. described in *Note Adding a New Configuration: Config.  If your new
  550. target is the same as your new host, you've probably already done that.
  551.  
  552.    A variety of files specify attributes of the GDB target environment:
  553.  
  554. `gdb/config/ARCH/TTT.mt'
  555.      Contains a Makefile fragment specific to this target.  Specifies
  556.      what object files are needed for target TTT, by defining
  557.      `TDEPFILES=...'.  Also specifies the header file which describes
  558.      TTT, by defining `TM_FILE= tm-TTT.h'.  You can also define
  559.      `TM_CFLAGS', `TM_CLIBS', `TM_CDEPS', and other Makefile variables
  560.      here; see `Makefile.in'.
  561.  
  562. `gdb/config/ARCH/tm-TTT.h'
  563.      (`tm.h' is a link to this file, created by configure).  Contains
  564.      macro definitions about the target machine's registers, stack
  565.      frame format and instructions.  Crib from existing `tm-*.h' files
  566.      when building a new one.
  567.  
  568. `gdb/TTT-tdep.c'
  569.      Contains any miscellaneous code required for this target machine.
  570.      On some machines it doesn't exist at all.  Sometimes the macros in
  571.      `tm-TTT.h' become very complicated, so they are implemented as
  572.      functions here instead, and the macro is simply defined to call
  573.      the function.
  574.  
  575. `gdb/exec.c'
  576.      Defines functions for accessing files that are executable on the
  577.      target system.  These functions open and examine an exec file,
  578.      extract data from one, write data to one, print information about
  579.      one, etc.  Now that executable files are handled with BFD, every
  580.      target should be able to use the generic exec.c rather than its
  581.      own custom code.
  582.  
  583. `gdb/config/ARCH/tm-ARCH.h'
  584.      This often exists to describe the basic layout of the target
  585.      machine's processor chip (registers, stack, etc).  If used, it is
  586.      included by `tm-XXX.h'.  It can be shared among many targets that
  587.      use the same processor.
  588.  
  589. `gdb/ARCH-tdep.c'
  590.      Similarly, there are often common subroutines that are shared by
  591.      all target machines that use this particular architecture.
  592.  
  593.    When adding support for a new target machine, there are various areas
  594. of support that might need change, or might be OK.
  595.  
  596.    If you are using an existing object file format (a.out or COFF),
  597. there is probably little to be done.  See `bfd/doc/bfd.texinfo' for
  598. more information on writing new a.out or COFF versions.
  599.  
  600.    If you need to add a new object file format, you must first add it to
  601. BFD.  This is beyond the scope of this document right now.  Basically
  602. you must build a transfer vector (of type `bfd_target'), which will
  603. mean writing all the required routines, and add it to the list in
  604. `bfd/targets.c'.
  605.  
  606.    You must then arrange for the BFD code to provide access to the
  607. debugging symbols.  Generally GDB will have to call swapping routines
  608. from BFD and a few other BFD internal routines to locate the debugging
  609. information.  As much as possible, GDB should not depend on the BFD
  610. internal data structures.
  611.  
  612.    For some targets (e.g., COFF), there is a special transfer vector
  613. used to call swapping routines, since the external data structures on
  614. various platforms have different sizes and layouts.  Specialized
  615. routines that will only ever be implemented by one object file format
  616. may be called directly.  This interface should be described in a file
  617. `bfd/libxxx.h', which is included by GDB.
  618.  
  619.    If you are adding a new operating system for an existing CPU chip,
  620. add a `tm-XOS.h' file that describes the operating system facilities
  621. that are unusual (extra symbol table info; the breakpoint instruction
  622. needed; etc).  Then write a `tm-XARCH-XOS.h' that just `#include's
  623. `tm-XARCH.h' and `tm-XOS.h'.  (Now that we have three-part
  624. configuration names, this will probably get revised to separate the XOS
  625. configuration from the XARCH configuration.)
  626.  
  627. 
  628. File: gdbint.info,  Node: Languages,  Next: Releases,  Prev: Target,  Up: Top
  629.  
  630. Adding a Source Language to GDB
  631. *******************************
  632.  
  633.    To add other languages to GDB's expression parser, follow the
  634. following steps:
  635.  
  636. *Create the expression parser.*
  637.      This should reside in a file `LANG-exp.y'.  Routines for building
  638.      parsed expressions into a `union exp_element' list are in
  639.      `parse.c'.
  640.  
  641.      Since we can't depend upon everyone having Bison, and YACC produces
  642.      parsers that define a bunch of global names, the following lines
  643.      *must* be included at the top of the YACC parser, to prevent the
  644.      various parsers from defining the same global names:
  645.  
  646.           #define yyparse     LANG_parse
  647.           #define yylex     LANG_lex
  648.           #define yyerror     LANG_error
  649.           #define yylval     LANG_lval
  650.           #define yychar     LANG_char
  651.           #define yydebug     LANG_debug
  652.           #define yypact      LANG_pact
  653.           #define yyr1        LANG_r1
  654.           #define yyr2        LANG_r2
  655.           #define yydef        LANG_def
  656.           #define yychk        LANG_chk
  657.           #define yypgo        LANG_pgo
  658.           #define yyact      LANG_act
  659.           #define yyexca      LANG_exca
  660.           #define yyerrflag      LANG_errflag
  661.           #define yynerrs      LANG_nerrs
  662.  
  663.      At the bottom of your parser, define a `struct language_defn' and
  664.      initialize it with the right values for your language.  Define an
  665.      `initialize_LANG' routine and have it call
  666.      `add_language(LANG_language_defn)' to tell the rest of GDB that
  667.      your language exists.  You'll need some other supporting variables
  668.      and functions, which will be used via pointers from your
  669.      `LANG_language_defn'.  See the declaration of `struct
  670.      language_defn' in `language.h', and the other `*-exp.y' files, for
  671.      more information.
  672.  
  673. *Add any evaluation routines, if necessary*
  674.      If you need new opcodes (that represent the operations of the
  675.      language), add them to the enumerated type in `expression.h'.  Add
  676.      support code for these operations in `eval.c:evaluate_subexp()'.
  677.      Add cases for new opcodes in two functions from `parse.c':
  678.      `prefixify_subexp()' and `length_of_subexp()'.  These compute the
  679.      number of `exp_element's that a given operation takes up.
  680.  
  681. *Update some existing code*
  682.      Add an enumerated identifier for your language to the enumerated
  683.      type `enum language' in `defs.h'.
  684.  
  685.      Update the routines in `language.c' so your language is included.
  686.      These routines include type predicates and such, which (in some
  687.      cases) are language dependent.  If your language does not appear
  688.      in the switch statement, an error is reported.
  689.  
  690.      Also included in `language.c' is the code that updates the variable
  691.      `current_language', and the routines that translate the
  692.      `language_LANG' enumerated identifier into a printable string.
  693.  
  694.      Update the function `_initialize_language' to include your
  695.      language.  This function picks the default language upon startup,
  696.      so is dependent upon which languages that GDB is built for.
  697.  
  698.      Update `allocate_symtab' in `symfile.c' and/or symbol-reading code
  699.      so that the language of each symtab (source file) is set properly.
  700.      This is used to determine the language to use at each stack frame
  701.      level.  Currently, the language is set based upon the extension of
  702.      the source file.  If the language can be better inferred from the
  703.      symbol information, please set the language of the symtab in the
  704.      symbol-reading code.
  705.  
  706.      Add helper code to `expprint.c:print_subexp()' to handle any new
  707.      expression opcodes you have added to `expression.h'.  Also, add the
  708.      printed representations of your operators to `op_print_tab'.
  709.  
  710. *Add a place of call*
  711.      Add a call to `LANG_parse()' and `LANG_error' in
  712.      `parse.c:parse_exp_1()'.
  713.  
  714. *Use macros to trim code*
  715.      The user has the option of building GDB for some or all of the
  716.      languages.  If the user decides to build GDB for the language
  717.      LANG, then every file dependent on `language.h' will have the
  718.      macro `_LANG_LANG' defined in it.  Use `#ifdef's to leave out
  719.      large routines that the user won't need if he or she is not using
  720.      your language.
  721.  
  722.      Note that you do not need to do this in your YACC parser, since if
  723.      GDB is not build for LANG, then `LANG-exp.tab.o' (the compiled
  724.      form of your parser) is not linked into GDB at all.
  725.  
  726.      See the file `configure.in' for how GDB is configured for different
  727.      languages.
  728.  
  729. *Edit `Makefile.in'*
  730.      Add dependencies in `Makefile.in'.  Make sure you update the macro
  731.      variables such as `HFILES' and `OBJS', otherwise your code may not
  732.      get linked in, or, worse yet, it may not get `tar'red into the
  733.      distribution!
  734.  
  735. 
  736. File: gdbint.info,  Node: Releases,  Next: Partial Symbol Tables,  Prev: Languages,  Up: Top
  737.  
  738. Configuring GDB for Release
  739. ***************************
  740.  
  741.    From the top level directory (containing `gdb', `bfd', `libiberty',
  742. and so on):
  743.      make -f Makefile.in gdb.tar.gz
  744.  
  745.    This will properly configure, clean, rebuild any files that are
  746. distributed pre-built (e.g. `c-exp.tab.c' or `refcard.ps'), and will
  747. then make a tarfile.  (If the top level directory has already been
  748. configured, you can just do `make gdb.tar.gz' instead.)
  749.  
  750.    This procedure requires:
  751.    * symbolic links
  752.  
  753.    * `makeinfo' (texinfo2 level)
  754.  
  755.    * TeX
  756.  
  757.    * `dvips'
  758.  
  759.    * `yacc' or `bison'
  760.  
  761. ... and the usual slew of utilities (`sed', `tar', etc.).
  762.  
  763. TEMPORARY RELEASE PROCEDURE FOR DOCUMENTATION
  764. ---------------------------------------------
  765.  
  766.    `gdb.texinfo' is currently marked up using the texinfo-2 macros,
  767. which are not yet a default for anything (but we have to start using
  768. them sometime).
  769.  
  770.    For making paper, the only thing this implies is the right
  771. generation of `texinfo.tex' needs to be included in the distribution.
  772.  
  773.    For making info files, however, rather than duplicating the texinfo2
  774. distribution, generate `gdb-all.texinfo' locally, and include the files
  775. `gdb.info*' in the distribution.  Note the plural; `makeinfo' will
  776. split the document into one overall file and five or so included files.
  777.  
  778. 
  779. File: gdbint.info,  Node: Partial Symbol Tables,  Next: Types,  Prev: Releases,  Up: Top
  780.  
  781. Partial Symbol Tables
  782. *********************
  783.  
  784.    GDB has three types of symbol tables.
  785.  
  786.    * full symbol tables (symtabs).  These contain the main information
  787.      about symbols and addresses.
  788.  
  789.    * partial symbol tables (psymtabs).  These contain enough
  790.      information to know when to read the corresponding part of the
  791.      full symbol table.
  792.  
  793.    * minimal symbol tables (msymtabs).  These contain information
  794.      gleaned from non-debugging symbols.
  795.  
  796.    This section describes partial symbol tables.
  797.  
  798.    A psymtab is constructed by doing a very quick pass over an
  799. executable file's debugging information.  Small amounts of information
  800. are extracted - enough to identify which parts of the symbol table will
  801. need to be re-read and fully digested later, when the user needs the
  802. information.  The speed of this pass causes GDB to start up very
  803. quickly.  Later, as the detailed rereading occurs, it occurs in small
  804. pieces, at various times, and the delay therefrom is mostly invisible to
  805. the user.  (*Note Symbol Reading::.)
  806.  
  807.    The symbols that show up in a file's psymtab should be, roughly,
  808. those visible to the debugger's user when the program is not running
  809. code from that file.  These include external symbols and types, static
  810. symbols and types, and enum values declared at file scope.
  811.  
  812.    The psymtab also contains the range of instruction addresses that the
  813. full symbol table would represent.
  814.  
  815.    The idea is that there are only two ways for the user (or much of
  816. the code in the debugger) to reference a symbol:
  817.  
  818.    * by its address (e.g. execution stops at some address which is
  819.      inside a function in this file).  The address will be noticed to
  820.      be in the range of this psymtab, and the full symtab will be read
  821.      in.  `find_pc_function', `find_pc_line', and other `find_pc_...'
  822.      functions handle this.
  823.  
  824.    * by its name (e.g. the user asks to print a variable, or set a
  825.      breakpoint on a function).  Global names and file-scope names will
  826.      be found in the psymtab, which will cause the symtab to be pulled
  827.      in.  Local names will have to be qualified by a global name, or a
  828.      file-scope name, in which case we will have already read in the
  829.      symtab as we evaluated the qualifier.  Or, a local symbol can be
  830.      referenced when we are "in" a local scope, in which case the first
  831.      case applies.  `lookup_symbol' does most of the work here.
  832.  
  833.    The only reason that psymtabs exist is to cause a symtab to be read
  834. in at the right moment.  Any symbol that can be elided from a psymtab,
  835. while still causing that to happen, should not appear in it.  Since
  836. psymtabs don't have the idea of scope, you can't put local symbols in
  837. them anyway.  Psymtabs don't have the idea of the type of a symbol,
  838. either, so types need not appear, unless they will be referenced by
  839. name.
  840.  
  841.    It is a bug for GDB to behave one way when only a psymtab has been
  842. read, and another way if the corresponding symtab has been read in.
  843. Such bugs are typically caused by a psymtab that does not contain all
  844. the visible symbols, or which has the wrong instruction address ranges.
  845.  
  846.    The psymtab for a particular section of a symbol-file (objfile)
  847. could be thrown away after the symtab has been read in.  The symtab
  848. should always be searched before the psymtab, so the psymtab will never
  849. be used (in a bug-free environment).  Currently, psymtabs are allocated
  850. on an obstack, and all the psymbols themselves are allocated in a pair
  851. of large arrays on an obstack, so there is little to be gained by
  852. trying to free them unless you want to do a lot more work.
  853.  
  854. 
  855. File: gdbint.info,  Node: Types,  Next: BFD support for GDB,  Prev: Partial Symbol Tables,  Up: Top
  856.  
  857. Types
  858. *****
  859.  
  860.    Fundamental Types (e.g., FT_VOID, FT_BOOLEAN).
  861.  
  862.    These are the fundamental types that GDB uses internally.
  863. Fundamental types from the various debugging formats (stabs, ELF, etc)
  864. are mapped into one of these.  They are basically a union of all
  865. fundamental types that gdb knows about for all the languages that GDB
  866. knows about.
  867.  
  868.    Type Codes (e.g., TYPE_CODE_PTR, TYPE_CODE_ARRAY).
  869.  
  870.    Each time GDB builds an internal type, it marks it with one of these
  871. types.  The type may be a fundamental type, such as TYPE_CODE_INT, or a
  872. derived type, such as TYPE_CODE_PTR which is a pointer to another type.
  873. Typically, several FT_* types map to one TYPE_CODE_* type, and are
  874. distinguished by other members of the type struct, such as whether the
  875. type is signed or unsigned, and how many bits it uses.
  876.  
  877.    Builtin Types (e.g., builtin_type_void, builtin_type_char).
  878.  
  879.    These are instances of type structs that roughly correspond to
  880. fundamental types and are created as global types for GDB to use for
  881. various ugly historical reasons.  We eventually want to eliminate
  882. these.  Note for example that builtin_type_int initialized in
  883. gdbtypes.c is basically the same as a TYPE_CODE_INT type that is
  884. initialized in c-lang.c for an FT_INTEGER fundamental type.  The
  885. difference is that the builtin_type is not associated with any
  886. particular objfile, and only one instance exists, while c-lang.c builds
  887. as many TYPE_CODE_INT types as needed, with each one associated with
  888. some particular objfile.
  889.  
  890. 
  891. File: gdbint.info,  Node: BFD support for GDB,  Next: Symbol Reading,  Prev: Types,  Up: Top
  892.  
  893. Binary File Descriptor Library Support for GDB
  894. **********************************************
  895.  
  896.    BFD provides support for GDB in several ways:
  897.  
  898. *identifying executable and core files*
  899.      BFD will identify a variety of file types, including a.out, coff,
  900.      and several variants thereof, as well as several kinds of core
  901.      files.
  902.  
  903. *access to sections of files*
  904.      BFD parses the file headers to determine the names, virtual
  905.      addresses, sizes, and file locations of all the various named
  906.      sections in files (such as the text section or the data section).
  907.      GDB simply calls BFD to read or write section X at byte offset Y
  908.      for length Z.
  909.  
  910. *specialized core file support*
  911.      BFD provides routines to determine the failing command name stored
  912.      in a core file, the signal with which the program failed, and
  913.      whether a core file matches (i.e. could be a core dump of) a
  914.      particular executable file.
  915.  
  916. *locating the symbol information*
  917.      GDB uses an internal interface of BFD to determine where to find
  918.      the symbol information in an executable file or symbol-file.  GDB
  919.      itself handles the reading of symbols, since BFD does not
  920.      "understand" debug symbols, but GDB uses BFD's cached information
  921.      to find the symbols, string table, etc.
  922.  
  923. 
  924. File: gdbint.info,  Node: Symbol Reading,  Next: Cleanups,  Prev: BFD support for GDB,  Up: Top
  925.  
  926. Symbol Reading
  927. **************
  928.  
  929.    GDB reads symbols from "symbol files".  The usual symbol file is the
  930. file containing the program which GDB is debugging.  GDB can be directed
  931. to use a different file for symbols (with the "symbol-file" command),
  932. and it can also read more symbols via the "add-file" and "load"
  933. commands, or while reading symbols from shared libraries.
  934.  
  935.    Symbol files are initially opened by `symfile.c' using the BFD
  936. library.  BFD identifies the type of the file by examining its header.
  937. `symfile_init' then uses this identification to locate a set of
  938. symbol-reading functions.
  939.  
  940.    Symbol reading modules identify themselves to GDB by calling
  941. `add_symtab_fns' during their module initialization.  The argument to
  942. `add_symtab_fns' is a `struct sym_fns' which contains the name (or name
  943. prefix) of the symbol format, the length of the prefix, and pointers to
  944. four functions.  These functions are called at various times to process
  945. symbol-files whose identification matches the specified prefix.
  946.  
  947.    The functions supplied by each module are:
  948.  
  949. `XXX_symfile_init(struct sym_fns *sf)'
  950.      Called from `symbol_file_add' when we are about to read a new
  951.      symbol file.  This function should clean up any internal state
  952.      (possibly resulting from half-read previous files, for example)
  953.      and prepare to read a new symbol file. Note that the symbol file
  954.      which we are reading might be a new "main" symbol file, or might
  955.      be a secondary symbol file whose symbols are being added to the
  956.      existing symbol table.
  957.  
  958.      The argument to `XXX_symfile_init' is a newly allocated `struct
  959.      sym_fns' whose `bfd' field contains the BFD for the new symbol
  960.      file being read.  Its `private' field has been zeroed, and can be
  961.      modified as desired.  Typically, a struct of private information
  962.      will be `malloc''d, and a pointer to it will be placed in the
  963.      `private' field.
  964.  
  965.      There is no result from `XXX_symfile_init', but it can call
  966.      `error' if it detects an unavoidable problem.
  967.  
  968. `XXX_new_init()'
  969.      Called from `symbol_file_add' when discarding existing symbols.
  970.      This function need only handle the symbol-reading module's
  971.      internal state; the symbol table data structures visible to the
  972.      rest of GDB will be discarded by `symbol_file_add'.  It has no
  973.      arguments and no result.  It may be called after
  974.      `XXX_symfile_init', if a new symbol table is being read, or may be
  975.      called alone if all symbols are simply being discarded.
  976.  
  977. `XXX_symfile_read(struct sym_fns *sf, CORE_ADDR addr, int mainline)'
  978.      Called from `symbol_file_add' to actually read the symbols from a
  979.      symbol-file into a set of psymtabs or symtabs.
  980.  
  981.      `sf' points to the struct sym_fns originally passed to
  982.      `XXX_sym_init' for possible initialization.  `addr' is the offset
  983.      between the file's specified start address and its true address in
  984.      memory.  `mainline' is 1 if this is the main symbol table being
  985.      read, and 0 if a secondary symbol file (e.g. shared library or
  986.      dynamically loaded file) is being read.
  987.  
  988.    In addition, if a symbol-reading module creates psymtabs when
  989. XXX_symfile_read is called, these psymtabs will contain a pointer to a
  990. function `XXX_psymtab_to_symtab', which can be called from any point in
  991. the GDB symbol-handling code.
  992.  
  993. `XXX_psymtab_to_symtab (struct partial_symtab *pst)'
  994.      Called from `psymtab_to_symtab' (or the PSYMTAB_TO_SYMTAB macro)
  995.      if the psymtab has not already been read in and had its
  996.      `pst->symtab' pointer set.  The argument is the psymtab to be
  997.      fleshed-out into a symtab.  Upon return, pst->readin should have
  998.      been set to 1, and pst->symtab should contain a pointer to the new
  999.      corresponding symtab, or zero if there were no symbols in that
  1000.      part of the symbol file.
  1001.  
  1002. 
  1003. File: gdbint.info,  Node: Cleanups,  Next: Wrapping,  Prev: Symbol Reading,  Up: Top
  1004.  
  1005. Cleanups
  1006. ********
  1007.  
  1008.    Cleanups are a structured way to deal with things that need to be
  1009. done later.  When your code does something (like `malloc' some memory,
  1010. or open a file) that needs to be undone later (e.g. free the memory or
  1011. close the file), it can make a cleanup.  The cleanup will be done at
  1012. some future point:  when the command is finished, when an error occurs,
  1013. or when your code decides it's time to do cleanups.
  1014.  
  1015.    You can also discard cleanups, that is, throw them away without doing
  1016. what they say.  This is only done if you ask that it be done.
  1017.  
  1018.    Syntax:
  1019.  
  1020. `struct cleanup *OLD_CHAIN;'
  1021.      Declare a variable which will hold a cleanup chain handle.
  1022.  
  1023. `OLD_CHAIN = make_cleanup (FUNCTION, ARG);'
  1024.      Make a cleanup which will cause FUNCTION to be called with ARG (a
  1025.      `char *') later.  The result, OLD_CHAIN, is a handle that can be
  1026.      passed to `do_cleanups' or `discard_cleanups' later.  Unless you
  1027.      are going to call `do_cleanups' or `discard_cleanups' yourself,
  1028.      you can ignore the result from `make_cleanup'.
  1029.  
  1030. `do_cleanups (OLD_CHAIN);'
  1031.      Perform all cleanups done since `make_cleanup' returned OLD_CHAIN.
  1032.      E.g.:
  1033.           make_cleanup (a, 0);
  1034.           old = make_cleanup (b, 0);
  1035.           do_cleanups (old);
  1036.  
  1037.      will call `b()' but will not call `a()'.  The cleanup that calls
  1038.      `a()' will remain in the cleanup chain, and will be done later
  1039.      unless otherwise discarded.
  1040.  
  1041. `discard_cleanups (OLD_CHAIN);'
  1042.      Same as `do_cleanups' except that it just removes the cleanups
  1043.      from the chain and does not call the specified functions.
  1044.  
  1045.    Some functions, e.g. `fputs_filtered()' or `error()', specify that
  1046. they "should not be called when cleanups are not in place".  This means
  1047. that any actions you need to reverse in the case of an error or
  1048. interruption must be on the cleanup chain before you call these
  1049. functions, since they might never return to your code (they `longjmp'
  1050. instead).
  1051.  
  1052. 
  1053. File: gdbint.info,  Node: Wrapping,  Next: Frames,  Prev: Cleanups,  Up: Top
  1054.  
  1055. Wrapping Output Lines
  1056. *********************
  1057.  
  1058.    Output that goes through `printf_filtered' or `fputs_filtered' or
  1059. `fputs_demangled' needs only to have calls to `wrap_here' added in
  1060. places that would be good breaking points.  The utility routines will
  1061. take care of actually wrapping if the line width is exceeded.
  1062.  
  1063.    The argument to `wrap_here' is an indentation string which is printed
  1064. *only* if the line breaks there.  This argument is saved away and used
  1065. later.  It must remain valid until the next call to `wrap_here' or
  1066. until a newline has been printed through the `*_filtered' functions.
  1067. Don't pass in a local variable and then return!
  1068.  
  1069.    It is usually best to call `wrap_here()' after printing a comma or
  1070. space.  If you call it before printing a space, make sure that your
  1071. indentation properly accounts for the leading space that will print if
  1072. the line wraps there.
  1073.  
  1074.    Any function or set of functions that produce filtered output must
  1075. finish by printing a newline, to flush the wrap buffer, before
  1076. switching to unfiltered ("`printf'") output.  Symbol reading routines
  1077. that print warnings are a good example.
  1078.  
  1079. 
  1080. File: gdbint.info,  Node: Frames,  Next: Remote Stubs,  Prev: Wrapping,  Up: Top
  1081.  
  1082. Frames
  1083. ******
  1084.  
  1085.    A frame is a construct that GDB uses to keep track of calling and
  1086. called functions.
  1087.  
  1088. `FRAME_FP'
  1089.      in the machine description has no meaning to the
  1090.      machine-independent part of GDB, except that it is used when
  1091.      setting up a new frame from scratch, as follows:
  1092.  
  1093.                 create_new_frame (read_register (FP_REGNUM), read_pc ()));
  1094.  
  1095.      Other than that, all the meaning imparted to `FP_REGNUM' is
  1096.      imparted by the machine-dependent code.  So, `FP_REGNUM' can have
  1097.      any value that is convenient for the code that creates new frames.
  1098.      (`create_new_frame' calls `INIT_EXTRA_FRAME_INFO' if it is
  1099.      defined; that is where you should use the `FP_REGNUM' value, if
  1100.      your frames are nonstandard.)
  1101.  
  1102. `FRAME_CHAIN'
  1103.      Given a GDB frame, determine the address of the calling function's
  1104.      frame.  This will be used to create a new GDB frame struct, and
  1105.      then `INIT_EXTRA_FRAME_INFO' and `INIT_FRAME_PC' will be called for
  1106.      the new frame.
  1107.  
  1108.